<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>order details update</title>
 <link href="../../resources/css/ligerui-all.css" rel="stylesheet" type="text/css" />
 <link href="../../resources/css/jquery-ui-1.9.2.custom.min.css" rel="stylesheet"  type="text/css" />

<script src="../../resources/js/jquery-1.9.1.min.js" type="text/javascript"></script> 
<script src="../../resources/js/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
<script src="../../resources/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript">
	var dish = [];//修改过的商品
	var delGoods = [];//删除掉的商品
	var addGoods = [];//添加商品
	var delTable = [];//添加座位
	var addTable = [];//删除座位
	var operationRecord = ""; //放置操作的那条记录的ID
	var account = 1;
	var record = 0;
	var finalRecord = 0;
	var order = eval(${jsonHeader});
	var manager = [];
	
	$(function(){
		
		$("button").button();//按钮控件
		var dictionaries = eval(${dictionaries});
		
		$("#orderNum").html("单号：" + order.documentNumber);
		$("#today").html("日期：" + order.orderDate);
		
		var tr1 = "<td id='t_had'>经手人：</td>" + "<td id='t_value'><input type='text' disabled='disabled' class='text ui-widget-content ui-corner-all' name='attn' value='" + order.attn + "' size='22'></td>" +
		        "<td id='t_had'>用餐时间：</td>" + "<td id='t_value'><div style='margin-left:.4em;'><input type='text' readonly='readonly' id='mealTime' name='mealTime'><div></td>" +
		        "<td id='t_had'>订单类型：</td>" + "<td id='t_value'><select class='select ui-widget-content ui-corner-all' style='width: 148px;' name='orderCategory'>";
		for(var i = 0; i < dictionaries.length; i++) {
			tr1 = tr1 + "<option codeValue='" + dictionaries[i].categoryCode + "' value='" + dictionaries[i].dictionaryId + "' ";
			if(dictionaries[i].categoryName == order.orderCategory)
				tr1 = tr1 + "selected='selected'"
			tr1 = tr1 + ">" + dictionaries[i].categoryName + "</option>";
		}         
		tr1 = tr1 + "</select></td>";
		$("#tr1").html(tr1);
		
		var tr2 = "<td id='t_had'>会员号：</td>" + "<td id='t_value'><input type='text' class='text ui-widget-content ui-corner-all' name='memberNo' value='" + order.memberNo + "' size='22' onblur='getMemberByNo(this.value)'><input type='hidden' name='memberId' value = ''></td>" +
		        "<td id='t_had'>会员姓名：</td>" + "<td id='t_value'><input type='text' disabled='disabled' class='text ui-widget-content ui-corner-all' name='memberName' value='" + order.memberName + "' size='22'></td>" +
		        "<td id='t_had'>座位：</td>" + "<td id='t_value'><input type='text' readonly='readonly' class='text ui-widget-content ui-corner-all' name='diningTableName' value='" + order.diningTableName + "' size='22' onclick='showTable()'></td>";
		$("#tr2").html(tr2);
		
		var tr3 = "<td id='t_had'>外送地址：</td>" + "<td id='t_value' colspan='3'><input type='text' class='text ui-widget-content ui-corner-all' size='70' name='deliveryAddress' value='" + order.deliveryAddress + "'></td>" +
				"<td id='t_had'>订单状态：</td>" + "<td id='t_value'><input type='text' disabled='disabled' class='text ui-widget-content ui-corner-all' name='orderStatus' value='" + order.orderStatus + "' size='22'></td>";
		$("#tr3").html(tr3);
		
		var tr3_1 = "<td id='t_had'>备注：</td>" + "<td id='t_value' colspan='5'><textarea id='remark' class='textarea ui-widget-content ui-corner-all' rows='1' cols='112'>" + order.remark + "</textarea></td>";
		$("#tr3_1").html(tr3_1);
		
		
		$("select[name=orderCategory]").change(function(){
			selectOrderCategoryCheck();
		});
		function selectOrderCategoryCheck() {
			var codeValue = $("select[name=orderCategory] option:selected").attr("codeValue");
			if(codeValue == "TABLE_ORDERING" || codeValue == "BOOKING_ORDERING") {
				$("input[name=diningTableName]").prop({"disabled": false, "value": order.diningTableName});
				if(manager.length != 0) setTabText();
				$("input[name=deliveryAddress]").prop({"disabled": true, "value": ""});
			}
			if(codeValue == "TAKE_OUT") {
				$("input[name=deliveryAddress]").prop({"disabled": false, "value": order.deliveryAddress});
				$("input[name=diningTableName]").prop({"disabled": true, "value": ""});
			}
		}
		selectOrderCategoryCheck();
		
		var orderheader = JSON.stringify(order);
		var url = "../showOrOperate/orderDetailsOperate?orderHeader=" + orderheader;
		/**返回上一页**/
		$("#returnSearchOrder").click(function(){
			window.location.href= url;
		});
		/**保存修改后的订单**/
		$("#saveOrder").click(function(){
			var orderModify = "";
			orderModify = checkOrders();
			if(orderModify != ""){
				$.post("../modifyOrder?modifyMsg=" + orderModify, function(data){
					if(data) {
						$( "#dialog-confirm" ).dialog("open");
					} else {
						$("#checkOrderMsg").html("<font class='check'><ul><li>对不起，系统出错了！</li><li>请您及时联系管理员！</li></ul></font>");
	    				$("#checkOrderMsg").focus();
					}
				});
			}
		});
	});
	
	function turnColor (id) {//改变颜色了
		$("#"+id).addClass("convertColor");
	}
	function changeBack(id) {//颜色变回来
		$("#"+id).removeClass("convertColor");
	}
	
	function turnOperation(orderDetailsId) {//单击tr行，显示 + - 操作
		//var tr_id = "tr_" + orderDetailsId;
		changeBackOperation(orderDetailsId);
		var html = "<label id='deleteRow_" + orderDetailsId 
			+ "'style='font-size: large; font-weight: 600;'><a onclick='deleteRowData(\""+ orderDetailsId + "\")'>-&nbsp;</a></label>" +
			"<label id='addRow_" + orderDetailsId + "' style='font-size: large; font-weight: 600;'><a onclick='addRowData(\""+ orderDetailsId + "\")'>&nbsp;+</a></label>";
		$("#td_name_" + orderDetailsId).append(html);
	}
	function changeBackOperation(orderDetailsId) {//还原，删除-+
		$("#deleteRow_" + orderDetailsId).remove();
		$("#addRow_" + orderDetailsId).remove();
	}
	
	function deleteRowData(orderDetailsId) {//删除一个商品，行数据
		if(record <=1 ) return false;
		record = record -1;
		var tr_id = "tr_" + orderDetailsId;
		var td_id = "td_id_" + orderDetailsId;
		var thisRowId = $("#" + td_id).html();
		var goodsName = $("input[name=goodsName_"+orderDetailsId+"]").prop("value");
		var goodsUP = $("#td_unit_" + orderDetailsId).text();
		
		if(orderDetailsId.split("_").length == 1) {	//确定是之前点过的（后台数据库有的）才删除
			dishJSON_delete(thisRowId);		//删除时,如果是修改过的，一点要从dish中移除
			delGoods.push("{orderDetailsId: " + orderDetailsId + "}");
		} else {
			goodsJSON_delete(thisRowId);	//删除时,如果是新添加的，一点要从addGoods中移除
		}
		
		/**菜单里的菜被选中后设置成disabled状态**/
		$("#a_" + thisRowId).removeClass("ui-state-disabled");
		$("#a_" + thisRowId).prop("href", "javascript:getGoodsDetails("+thisRowId+", '"+goodsName+"', '"+goodsUP+"')");
		$("#" + tr_id).remove();//删除表格行
	}
	
	function addRowData(orderDetailsId) {//添加一个行，添加数据
		record = record + 1;
		changeBackOperation(orderDetailsId);
		var tr_id = "tr_" + orderDetailsId;
		var td_id_suffix = orderDetailsId + "_" + account;
		
		var html ="<tr id='tr_"+td_id_suffix+"' ondblclick='turnOperation(\""+td_id_suffix+"\")'" +	"onmouseover='turnColor(this.id)' onmouseout='changeBack(this.id)'>" +
         	"<td id='td_id_"+td_id_suffix+"' class='t_value_class'>"+td_id_suffix+"</td>" +
         	"<td id='td_name_"+td_id_suffix+"' class='t_value_class'  colspan='2'>"+
         		"<input type='text' class='text ui-widget-content ui-corner-all' name='goodsName_"+td_id_suffix+"' value='' onclick='addGoodsFunction(\""+td_id_suffix+"\")'>"+
         	"</td>" +
         	"<td id='td_unit_"+td_id_suffix+"' class='t_value_class'></td>"+
         	"<td id='td_amount_"+td_id_suffix+"' class='t_value_class'>" +
         		"<input id='spinner"+td_id_suffix+"' disabled='disabled' name='share"+td_id_suffix+
         		"' value='1' size='2' onblur='spinnerOperation(this.id, \"" + td_id_suffix + "\")'/>"+"</td>" + 
         	"<td id='td_total_"+td_id_suffix+"' class='t_value_class'></td>"+"</tr>";
		$("#" + tr_id).after(html);
		$( "#spinner" + orderDetailsId + "_" + account).spinner();
		account = account + 1;
	}

	//点菜无封顶，最少只能点一份
	function goodsSpinner(spinnerId) {
		var val = $("#" + spinnerId).prop("value");
		if(val <=0 || isNaN(val)) {
			$("#" + spinnerId).prop("value", 1);
			return 1;
		}
		return val;
	}
	
	function calculateMn(sglAmount, unitP) {//一种商品的总价
		var singleTotalPrice = Number(sglAmount) * Number(unitP);
		return singleTotalPrice;
	}
	
	function spinnerOperation(spId, ordDelId) {//改变数量时调用这个操作
		var td_id = "td_id_" + ordDelId;
		var td_unit = "td_unit_" + ordDelId;
		var goodsId = $("#" + td_id).text();
		var goodsName = $("input[name=goodsName_"+ordDelId+"]").prop("value");
		var unitPrice = $("#" + td_unit).text();
		var sglAmount = goodsSpinner(spId);
		var sglTotal = calculateMn(sglAmount, unitPrice);
		$("#td_total_" + ordDelId).html(sglTotal);
		
		if(ordDelId.split("_").length == 1) {
			dishJSON_Mdfy(goodsId, goodsName, unitPrice, sglAmount, sglTotal);
		} else {
			goodsJSON_Add(goodsId, goodsName, unitPrice, sglAmount, sglTotal);
		}
	}
	
	/**************************JSON格式的商品****************************/
	function dishJSON_Mdfy(orderDetailsId, goodsName, goodsUnitPrice, amount, goodsTotalSalesPrice){//修改
		for(var i = 0; i < dish.length; i++) {
			var goods = eval('('+dish[i]+')');
			if(goods.orderDetailsId == orderDetailsId) {
				dishJSON_delete(orderDetailsId);
			}
		}
		dish.push("{orderDetailsId: " + orderDetailsId + ", goodsName: '" + goodsName + "', goodsUnitPrice:  " + goodsUnitPrice + ", amount: " + amount + ", goodsTotalSalesPrice: " + goodsTotalSalesPrice + "}");
	}
	/**根据菜Id删除商品**/
	function dishJSON_delete(goodsId) {
		for(var i = 0; i < dish.length; i++) {
			var goods = eval('('+dish[i]+')');
			if(goods.orderDetailsId == goodsId) {
				dish.splice(i,1);//删除放弃选中的
			}
		}
	}
	
	/**************************Add****************************/
	function goodsJSON_Add(goodsId, goodsName, goodsUnitPrice, amount, goodsTotalSalesPrice){//添加
		for(var i = 0; i < addGoods.length; i++) {
			var goods = eval('('+addGoods[i]+')');
			if(goods.goodsId == goodsId) {
				goodsJSON_delete(goodsId);
			}
		}
		addGoods.push("{goodsId: " + goodsId + ", goodsName: '" + goodsName + "', unitPrice:  " + goodsUnitPrice + ", amount: " + amount + ", goodsTotalSalesPrice: " + goodsTotalSalesPrice + "}");
	}
	/**根据菜Id删除新添加的商品**/
	function goodsJSON_delete(goodsId) {
		for(var i = 0; i < addGoods.length; i++) {
			var goods = eval('('+addGoods[i]+')');
			if(goods.goodsId == goodsId) {
				addGoods.splice(i,1);//删除放弃选中的
			}
		}
	}/**************************Add****************************/
	/**************************显示餐桌****************************/
	function showTable () {
		var isLoad = $("#showTable").attr("tableIsLoad");
		if(isLoad == 'true') {
			$("#showTable").dialog("open");
			return false;
		}
		$("#showTable").attr("tableIsLoad", 'true');
		$.post("../getAllTable?hasBeanSelectedTable=" + order.diningTableName, function(data){
			//var treeData =  eval(data);
			var treeData =  eval(data);
			manager = $("#tableTree").ligerTree({
				data: treeData,
				idFieldName: 'id', 
				parentIDFieldName: 'pid',
				onCheck: onCheckTable,
			});
			$("#showTable").dialog("open");
			var manData = manager.data;
			for(var i = 0; i < manData.length; i++) {
				var id = manData[i].id;
				$("li[id=" + id + "] div > div:eq(1)").hide();	//隐藏父节点的多选框（其实是一个div）
			}
		});
	}
	
	//选中或放弃选中座位时
	function onCheckTable(node, checked) {
		var selTab = (order.diningTableName).split(";");//初始状态时选中的座位
		var diningTableId = (node.data.id).split("_")[1];	//座位ID
		var diningTableName = node.data.text;				//座位名称
		
		if(checked) {
			if(selTab.toString().indexOf(diningTableName) == -1)
				addTable.push("{diningTableId: " + diningTableId + "}");
			else 
				removeTabById(diningTableId, delTable);
		} else {
			if(selTab.toString().indexOf(diningTableName) > -1)
				delTable.push("{diningTableId: " + diningTableId + "}");
			else 
				removeTabById(diningTableId, addTable);
		}
	}
	/**删除座位**/
	function removeTabById(tableId, arr) {
		for(var i = 0; i < arr.length; i++) {
			var table = eval('('+arr[i]+')');
			if(table.diningTableId == tableId) {
				arr.splice(i,1);//删除放弃选中的
			}
		}
	}
	function setTabText() {//设置座位的value
		var notes = manager.getChecked();
		var text = "";
        for (var i = 0; i < notes.length; i++) {
            text += notes[i].data.text + ";";
            $("input[name=diningTableName]").prop("value", text);
        }
	}
	$(function() {
		$( "#menuShow" ).dialog({
			resizable: false, height:470, width: 400, modal: true,
			autoOpen: false, show: "blind",	hide: "explode"
		});
		$( "#dialog-confirm" ).dialog({
			resizable: false, height:180, width: 300, modal: true, autoOpen: false, show: "blind",	hide: "explode",
			buttons: {
				"确定": function() {
					$( this ).dialog( "close" );
					window.location.href= "../index";
				}
			}
		});
		$("#showTable").dialog({
			resizable: false, height:450, width: 210, modal: true, autoOpen: false, show: "blind",	hide: "explode",
			buttons: {
				"确定": function() {
					setTabText();
					$( this ).dialog( "close" );
				}
			}
		});
		$( "#menu" ).menu();
		/**日期控件**/
		$("#mealTime").ligerDateEditor({ showTime: true, width: '140', initValue: order.mealTime});
		
	});
	function addGoodsFunction(tr_id) {
		operationRecord = tr_id;
		$( "#menuShow" ).dialog( "open");
	}
	function getGoodsDetails(goodsId, goodsName, goodsUnitPrice) {
		var td_id = "td_id_" + operationRecord;
		var goodsNameName = "goodsName_" + operationRecord;
		var td_unit = "td_unit_" + operationRecord;
		var goodsAmount = "share" + operationRecord;
		var td_total = "td_total_" + operationRecord;
		
		/**添加一个商品, 将选中的商品状态设置成disabled状态**/
		$("#a_"+goodsId).addClass("ui-state-disabled");
		$("#a_"+goodsId).prop("href", "#");
		
		var prefixId = $("#" + td_id).text();
		goodsJSON_delete(prefixId);	//删掉修改之前的那条记录，不然相当于重复添加一个栏位的多条记录，但是记录只有一条
		
		/**删除完dish的旧记录后再修改页面显示的记录**/
		$("#" + td_id).text(goodsId);
		$("input[name=" + goodsNameName + "]").prop("value", goodsName);
		$("#" + td_unit).text(goodsUnitPrice);
		$("input[name=" + goodsAmount + "]").prop("value", 1);
		$("input[name=" + goodsAmount + "]").removeProp("disabled");
		$("#" + td_total).text(goodsUnitPrice); //数量默认是1,总价默认就是单价的价格
		$( "#menuShow" ).dialog( "close");
		/**将添加进来的数据放到dish里面**/
		goodsJSON_Add(goodsId, goodsName, goodsUnitPrice, 1, goodsUnitPrice);
	}
	
	/**根据会员号获取会员信息**/
	function getMemberByNo(memberNo) {
		if(memberNo.trim() == "" || memberNo == null) {
			setMemberMsgNull();
			return false;
		}
		$.ajax({	
			url: '../getMember/' + memberNo.trim(),
			type: 'post',
			dateType: 'json',
			success: function(data) {
				var member = eval(data);
				if(member == null) {
					setMemberMsgNull();
				} else {
					$("input[name=memberName]").prop("value", member.memberName);
					$("input[name=memberId]").prop("value", member.memberId);
					var codeValue = $("select[name=orderCategory] option:selected").attr("codeValue");
					if(codeValue == "TAKE_OUT")
						$("input[name=deliveryAddress]").prop("value", member.address);
				}
			},
			error: function() {	alert("\(^o^)/出错咯！！");	}
		});
	}
	function setMemberMsgNull() {//设置会员信息为空
		$("input[name=memberName]").prop("value", "");
		$("input[name=deliveryAddress]").prop("value", "");
		$("input[name=memberId]").prop("value", "");
	}
	
	/**验证订单**/
    function checkOrders() {
    	var oneOrder = "";
    	var tableOperationStatus = 0;	//座位操作的状态
    	var mealTime = $("input[name=mealTime]").prop("value");
    	var orderCategory = $("select[name=orderCategory] option:selected").prop("value");
		var codeValue = $("select[name=orderCategory] option:selected").attr("codeValue");
		var diningTableName = $("input[name=diningTableName]").prop("value");
		var deliveryAddress = $("input[name=deliveryAddress]").prop("value");
		var remark = $("#remark").prop("value");
		var memberNo = $("input[name=memberNo]").prop("value");
		var memberId = $("input[name=memberId]").prop("value");
		var memberName = $("input[name=memberName]").prop("value");
    	
    	/**订单的三个状态：TABLE_ORDERING BOOKING_ORDERING  TAKE_OUT**/
    	if(codeValue == "TABLE_ORDERING" || codeValue == "BOOKING_ORDERING") {
    		if(diningTableName == "") {
    			$("#checkOrderMsg").html("<font class='check'><ul><li>·请录入座位号！</li></ul></font>");
    			$("input[name=diningTableName]").focus();
    			return oneOrder;
    	}} 
		if(codeValue == "BOOKING_ORDERING" || codeValue == "TAKE_OUT") {
    		if(mealTime == "") {
    			$("#checkOrderMsg").html("<font class='check'><ul><li>·请选择用餐时间！</li></ul></font>");
    			$("input[name=mealTime]").focus();
    			return oneOrder;
    	}} 
		if(codeValue == "TAKE_OUT") {
    		if(deliveryAddress == "") {
    			$("#checkOrderMsg").html("<font class='check'><ul><li>·请输入外送地址！</li></ul></font>");
    			$("input[name=deliveryAddress]").focus();
    				//这个状态导致删除所有订单所存在的关联座位
    			return oneOrder;
    		}
    		tableOperationStatus = -1;
    	}
		if(memberNo.trim() != "" ) {
			if(memberName == ""){
				$("#checkOrderMsg").html("<font class='check'><ul><li>·会员号不存在，没有对应的注册会员！</li><li>·或者不是会员，可令会员号为空！</li></ul></font>");
				$("input[name=memberNo]").focus();
				return oneOrder;
		}}
		if(finalRecord == delGoods.length) {
			if(dish.length == 0) {
	    		$("#checkOrderMsg").html("<font class='check'><ul><li>·请您点菜！</li></ul></font>");
	    		return oneOrder;
	    	}
		}
    	
		$("#checkOrderMsg").empty();
		if(delTable.length != 0 || addTable.length != 0) {
			tableOperationStatus = 1;
		}
    	oneOrder = "{modifyGoods: [" +dish + "], delGoods: [" +  delGoods + "], addGoods: [" +  addGoods + "],  deliveryAddress: '" 
			+ deliveryAddress + "', orderCategory: '" + orderCategory + "', mealTime: '" + mealTime + "', remark: '" 
			+ remark + "', memberNo: '" + memberNo + "', memberId: '" + memberId + "', memberName: '" + memberName + "', codeValue: '" 
			+ codeValue + "', diningTableName: '" + diningTableName + "', orderHeaderId: '" + order.orderHeaderId 
			+ "', tableOperationStatus: " + tableOperationStatus + ", delTable: [" + delTable + "], addTable: [" + addTable + "]}";
		return oneOrder;
    }
	
</script>
<style type="text/css">
	body { font-size:12px;}
	table tr {background-color:#D7DBE3;}
	table {border: 1px; width: 100%; background-color: #666666; border-spacing: 1px; border-collapse:separate;}
	input, textarea, select{border:none; background:none; padding:.2em; margin:.2em 0; vertical-align:middle; margin-left:.4em;}
	a:link {color: #333333; text-decoration:none;}   
	a:active:{color: red; }
	a:visited {color:#333333;text-decoration:none;} 
	a:hover {color: red; text-decoration: underline;}
	
	#t_had {text-align:right; width:70px; height: 25px;}
	#t_had1 {text-align:center; font-weight: bold; height: 25px;}
	#t_value {width:100px; height: 25px;}
	#t_value1 {text-align:center; height: 25px;}
	#o_account {text-align:center; font-size:20px; font-weight:bold;}
	
	.t_value_class{text-align:center; height: 25px;}
	.l-table-edit-td{ padding:1px;}
	.statusClass {color:red; font-style: oblique;}
	.convertColor {background-color:#F0F5FF;}
	.check{ font-size: 18px; font-weight: 900; color: red;}
	.ui-menu { width: 150px;}
</style>
</head>
<body style="margin-left: 2px;">

<div id="talBar"><span style=" margin: 5px 10px; display: block; font-weight: bold;">宝华茶餐厅 > 订单管理 > 订单查询 > 订单明细 > 订单修改</span></div>
<div id="checkOrderMsg" style="margin: 5px 10px;"></div>
<div style="width:700px; float: left;">
<div style=" width:100%; border-style:double; border-color:#666666; background-color: #D7DBE3;">
	<div>
	<div align="center" style="margin-bottom:5px; margin-top:2px; font-size: 25px; font-weight: 700;">宝华茶餐厅-订单明细</div>
	<div id="orderNum" style=" color:#FF0000; float: left; margin: 3px;"></div><div style="float: right; margin: 3px;" id="today"></div>
	</div>
	<table id="t_table" border="0" align="center">
        	<tr id = "tr1"></tr>
            <tr id = "tr2"></tr>
            <tr id = "tr3"></tr>
            <tr id = "tr3_1"></tr>
            <tr>
            	<td id="t_had1">商品编号</td>
                <td colspan="2" id="t_had1">商品名称</td>
                <td id="t_had1">单价（元）</td>
                <td id="t_had1">数量（个）</td>
                <td id="t_had1">总价（元）</td>
            </tr>
            <c:forEach  items="${lists }" var="list" varStatus="goodsStatus">
            <tr id='tr_${list.orderDetailsId }' ondblclick="turnOperation('${list.orderDetailsId }')" onmouseover="turnColor(this.id)" onmouseout="changeBack(this.id)" >
	         	<td id='td_id_${list.orderDetailsId }' class="t_value_class">${list.orderDetailsId }</td>
	         	<td id='td_name_${list.orderDetailsId }' class="t_value_class"  colspan='2'>
	         		<input type="text" class='text ui-widget-content ui-corner-all' name="goodsName_${list.orderDetailsId }" 
	         			value="${list.goodsName }" readonly="readonly">
	         	</td>
	         	<td id='td_unit_${list.orderDetailsId }' class="t_value_class">${list.goodsUnitPrice }</td>
	         	<td id='td_amount_${list.orderDetailsId }' class="t_value_class">
	         		<input id="spinner${list.orderDetailsId }" name="share${list.orderDetailsId }" value='${list.amount }' 
	         			size='2' onblur="spinnerOperation(this.id, '${list.orderDetailsId }')"/>
	         		<script type="text/javascript">
		         		$( "#spinner" + ${list.orderDetailsId }).spinner();
		         		record = record + 1; finalRecord = finalRecord + 1;
	         		</script>
	         	</td>
	         	<td id='td_total_${list.orderDetailsId }' class="t_value_class">${list.goodsTotalSalesPrice }</td>
	        </tr>
	        </c:forEach>
	        <tr id="tr4"></tr>
        </table>
        <div style="margin-bottom:5px; margin-top: 10px;"></div>
        
</div>
<div style=" background-color:#F0F5FF; height:40px; margin-top:10px; padding-right:10px; vertical-align:middle; padding-top:10px; text-align:right; border-top-color:gray; width:100%; float:left;">
	<button id="saveOrder" value="" name="save">保存订单</button>
	<button id="deprecatedOrder" value="" name="deprecated" disabled="disabled">作废</button>
	<button id="returnSearchOrder" value="" name="return">返回</button>
</div>
</div>
<div id="menuShow" title="菜		单">
<ul id="menu">
	<c:forEach items="${memnCtgis }" var="menuCtgy">
		<li><a href="#">${menuCtgy.categoryName }</a>
			<ul style="width: 200px;">
				<c:forEach items="${goodsLists }" var="goods">
					<c:if test="${menuCtgy.dictionaryId eq goods.goodsCategory }">
						<li><a id="a_${goods.goodsId }" href="javascript:getGoodsDetails(${goods.goodsId}, '${goods.goodsName }', '${goods.goodsUnitPrice }')">${goods.goodsName }&nbsp;￥${goods.goodsUnitPrice }元</a></li>
						<c:forEach  items="${lists }" var="orderDetails">
							<c:if test="${orderDetails.goods.goodsId eq goods.goodsId }">
								<script type="text/javascript">
									$("#a_"+${goods.goodsId}).addClass("ui-state-disabled");
									$("#a_"+${goods.goodsId}).prop("href", "#");
								</script>
							</c:if>
						</c:forEach>
					</c:if>
				</c:forEach>
			</ul>
		</li>
	</c:forEach>
</ul>
</div>
<div id="showTable" tableIsLoad='false' title="座	位">
	<ul id="tableTree"></ul>
</div>
<div id="dialog-confirm" title="修改订单成功了！">
<p style="margin-top: 10px;"><span class='ui-icon ui-icon-alert' style='float:left; margin:0px 7px 10px 0;'></span>成功修改订单后，点击【确定】按钮，跳转到订单查询界面！</p>
</div>
</body>
</html>